package com.ruoyi.project.zxcrm.quartz.factory;

import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.project.zxcrm.domain.CrmSmsLog;
import com.ruoyi.project.zxcrm.mapper.CrmSmsSendLogMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.TimerTask;

/**
 * @author: Qbzzz
 * @version: 1.0
 * @description: TODO
 * @create: 2023/4/11 16:10
 */

public class AsyncErrFactory {
    public static final Logger LOGGER = LoggerFactory.getLogger(AsyncErrFactory.class);

    /**
     * @param message  错误消息
     * @return 任务
     */
    public static TimerTask recordErrLog(String message, CrmSmsLog c) {
        return new TimerTask() {
            @Override
            public void run() {
                c.setLogErrInfo(message);
                SpringUtils.getBean(CrmSmsSendLogMapper.class).updateSmsLog(c);
            }
        };
    }
}
